// this is a class for an AtariGo game (who captures the first stone wins)

package com.klangner.go.app.rules;

import com.klangner.game.board.IBoard;

public class AtariGoGame extends GoGame {

  public AtariGoGame() {}

  public AtariGoGame(int boardSize, Player blackPlayer, Player whitePlayer) {
    super(boardSize, blackPlayer, whitePlayer);
  }

  // this is specific for AtariGo: when the first caption occurs the game is over
  public boolean gameOver() {
    if ((nrCapturedStones <= 0) && (consecutivePasses < 2))
      return false;
    else {
      if (consecutivePasses >= 2)
        gameResult = GoConstants.JIGO;
      else if (turn == IBoard.WHITE_STONE)
        gameResult = GoConstants.BlackWIN;
      else
        gameResult = GoConstants.WhiteWIN;  
      return true;
    }

  }

}